//
//  DiscoverViewController.m
//  AutoHome
//
//  Created by Flying meat on 9/11/15.
//  Copyright (c) 2015 CaoFeng. All rights reserved.
//

#import "DiscoverViewController.h"
#import "DiscoverCell.h"
@interface DiscoverViewController ()<UITableViewDataSource,UITableViewDelegate>

{
    
    NSArray * _titleArray;
    NSArray * _picArray;
    
}
@property (weak, nonatomic) IBOutlet UITableView *discoerTableView;
@property (nonatomic,strong) UIView *headView;
@end
@implementation DiscoverViewController
- (instancetype)initWithCoder:(NSCoder *)coder
{
    self = [super initWithCoder:coder];
    if (self) {
        _titleArray=[[NSArray alloc]init];
        
        _picArray=[[NSArray alloc]init];
        
        _titleArray=@[@[@"活动/团购"],@[@"汽车电台"],@[@"车型对比",@"购车计算",@"违章查询",@"找二手车"],@[@"车商城*瑞虎5火热售卖",@"养车特惠"],@[@"电动车之家"]];
        _picArray=@[@[@"discoveryfunction_14.png"],@[@"discoveryfunction_13.png"],@[@"discoveryfunction_6.png",@"discoveryfunction_7.png",@"discoveryfunction_8.png",@"discoveryfunction_9.png"],@[@"discoveryfunction_11.png",@"discoveryfunction_10.png"],@[@"discoveryfunction_12.png"]];
        
        
        
        
    }
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
 
    [self setView];

}
-(void)setView
{
    
    self.headView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 320,100)];
    self.headView.backgroundColor=[UIColor brownColor];
    self.discoerTableView.tableHeaderView=self.headView;

    
    
    
    
    
    
}


#pragma mark -UITableViewDelegate,UITableViewDataSource
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    NSArray *array=_titleArray[section];
    
    return  array.count;
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    
    
    return _titleArray.count;
    
}

-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
        DiscoverCell*cell=[tableView dequeueReusableCellWithIdentifier:@"DiscoverCell"];
    cell.accessoryType=UITableViewCellStyleValue1;
    NSArray*array=_titleArray[indexPath.section];
    NSArray *picarry=_picArray[indexPath.section];

    
    cell.imageView.image=[UIImage imageNamed:picarry[indexPath.row]];
    cell.textLabel.text=array[indexPath.row];
    
    return cell;
    
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    
    return 10;
    
}






- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
